<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Running Pipelines</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Running Pipelines' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">pipeline</a></li><li><a href="index.html#2">Chapter 2: Pipelines</a></li><li><b>Running Pipelines</b></li></ul></div>
<p class="purpose">To run through pipelines of code generation stages.</p>

<ul class="toc"><li><a href="2-rp.html#SP1">&#167;1. Ephemeral data</a></li><li><a href="2-rp.html#SP5">&#167;5. Popular symbols cache</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Ephemeral data.</b>This is temporary data meaningful only while a pipeline is running; it is
"cleaned", that is, reinitialised, at the start of each pipeline run.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">pipeline_ephemera</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">memory_repository</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">trees</span><span class="plain-syntax">[10];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">assimilation_modules</span><span class="plain-syntax">[10];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">replacements_list</span><span class="plain-syntax">[10];</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">pipeline_ephemera</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RunningPipelines::clean_pipeline</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">RunningPipelines::clean_pipeline</span></span>:<br/>Parsing Pipelines - <a href="2-pp.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pl</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pl</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">memory_repository</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;10; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pl</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">trees</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pl</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">assimilation_modules</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pl</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">replacements_list</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure pipeline_ephemera is accessed in 2/rmss, 3/ps, 3/css, 4/lbks and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">pipeline_step_ephemera</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">parsed_filename</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">the_kit</span><span class="plain-syntax">; </span><span class="comment-syntax"> if one is involved</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">to_debugging_log</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">from_memory</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">to_stream</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">requirements_list</span><span class="plain-syntax">; </span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">attachment_instruction</span></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tree</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">for_VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_RPSYM</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">package_argument</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cached_symbols_fetched</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_RPSYM</span><span class="plain-syntax">];</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">pipeline_step_ephemera</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RunningPipelines::clean_step</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">RunningPipelines::clean_step</span></span>:<br/><a href="2-rp.html#SP3_1_1">&#167;3.1.1</a><br/>Parsing Pipelines - <a href="2-pp.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">parsed_filename</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">to_stream</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">to_debugging_log</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">from_memory</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">the_kit</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">tree</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">pipeline</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">requirements_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="reserved-syntax">attachment_instruction</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">for_VM</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">package_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="constant-syntax">MAX_RPSYM</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols_fetched</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure pipeline_step_ephemera is accessed in 2/pp, 2/pe, 2/ns, 2/rmss, 3/ps, 3/rccs, 3/css, 4/lbks, 4/sws, 4/dics, 4/mius, 4/rvs, 5/msms, 6/erms, 6/erls, 6/eros and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>This outer layer is all just instrumentation, really: we run through the
steps in turn, timing how long each one took us.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">currently_running_pipeline_step</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RunningPipelines::run</span><span class="plain-syntax">(</span><span class="identifier-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">the_kit</span><span class="plain-syntax">, </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">requirements_list</span><span class="plain-syntax">, </span><span class="identifier-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">tracing</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">I</span><span class="plain-syntax">) </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">memory_repository</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">stopwatch_timer</span><span class="plain-syntax"> *</span><span class="identifier-syntax">within</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">CORE_MODULE</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">within</span><span class="plain-syntax"> = </span><span class="identifier-syntax">inform7_timer</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">stopwatch_timer</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline_timer</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Time::start_stopwatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">within</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"running Inter pipeline"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">step_count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">step_total</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LinkedLists::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">steps</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">active</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">stopwatch_timer</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prep_timer</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">steps</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">active</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Run this step, timing and logging it</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Time::stop_stopwatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline_timer</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Run this step, timing and logging it</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">currently_running_pipeline_step</span><span class="plain-syntax"> = </span><span class="identifier-syntax">step</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prep_timer</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prep_timer</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Time::start_stopwatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline_timer</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"step preparation"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Time::resume_stopwatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">prep_timer</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1_1" class="named-paragraph-link"><span class="named-paragraph">Prepare ephemeral data for this step</span><span class="named-paragraph-number">3.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Time::stop_stopwatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">prep_timer</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">STAGE_NAME</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">STAGE_NAME</span><span class="plain-syntax">, </span><span class="string-syntax">"step %d/%d: "</span><span class="plain-syntax">, ++</span><span class="identifier-syntax">step_count</span><span class="plain-syntax">, </span><span class="identifier-syntax">step_total</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-pp.html#SP12" class="function-link"><span class="function-syntax">ParsingPipelines::write_step</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">STAGE_NAME</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Log::new_stage</span><span class="plain-syntax">(</span><span class="identifier-syntax">STAGE_NAME</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">tracing</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">STDOUT</span><span class="plain-syntax">, </span><span class="string-syntax">"%S\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">STAGE_NAME</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">stopwatch_timer</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step_timer</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Time::start_stopwatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline_timer</span><span class="plain-syntax">, </span><span class="identifier-syntax">STAGE_NAME</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">STAGE_NAME</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">active</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1_2" class="named-paragraph-link"><span class="named-paragraph">Run this step</span><span class="named-paragraph-number">3.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Time::stop_stopwatch</span><span class="plain-syntax">(</span><span class="identifier-syntax">step_timer</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">currently_running_pipeline_step</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-rp.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_1_1" class="paragraph-anchor"></a><b>&#167;3.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Prepare ephemeral data for this step</span><span class="named-paragraph-number">3.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="2-rp.html#SP2" class="function-link"><span class="function-syntax">RunningPipelines::clean_step</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">the_kit</span><span class="plain-syntax"> = </span><span class="identifier-syntax">the_kit</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">trees</span><span class="plain-syntax">[</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax">] == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">trees</span><span class="plain-syntax">[</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax">] = </span><span class="identifier-syntax">InterTree::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">assimilation_modules</span><span class="plain-syntax">[</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">trees</span><span class="plain-syntax">[</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">I</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-pe.html#SP2" class="function-link"><span class="function-syntax">PipelineErrors::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="string-syntax">"no Inter tree to apply this step to"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">active</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">tree</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">pipeline</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">requirements_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">requirements_list</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">for_VM</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">take_generator_argument_from_VM</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">generator_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Generators::find_for</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">generator_argument</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-pe.html#SP2" class="function-link"><span class="function-syntax">PipelineErrors::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="string-syntax">"unable to guess a suitable code-generator"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">active</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">package_argument</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">package_argument</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">InterPackage::from_URL</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">tree</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">package_argument</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-pe.html#SP2" class="function-link"><span class="function-syntax">PipelineErrors::error_with</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"pipeline step applied to package which does not exist: '%S'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">package_URL_argument</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">active</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-rp.html#SP3_1">&#167;3.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_1_2" class="paragraph-anchor"></a><b>&#167;3.1.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Run this step</span><span class="named-paragraph-number">3.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-pp.html#SP4" class="function-link"><span class="function-syntax">ParsingPipelines::will_write_a_file</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_arg</span><span class="plain-syntax"> != </span><span class="constant-syntax">OPTIONAL_TEXT_OUT_STAGE_ARG</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><a href="2-pe.html#SP2" class="function-link"><span class="function-syntax">PipelineErrors::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="string-syntax">"no filename given in pipeline step"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">active</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"*log"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">to_stream</span><span class="plain-syntax"> = </span><span class="identifier-syntax">DL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1_2_2" class="named-paragraph-link"><span class="named-paragraph">Call the stage execution function</span><span class="named-paragraph-number">3.1.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"-"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">to_stream</span><span class="plain-syntax"> = </span><span class="identifier-syntax">STDOUT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1_2_2" class="named-paragraph-link"><span class="named-paragraph">Call the stage execution function</span><span class="named-paragraph-number">3.1.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1_2_1" class="named-paragraph-link"><span class="named-paragraph">Work out the filename</span><span class="named-paragraph-number">3.1.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_output_struct</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">T</span><span class="plain-syntax"> = &amp;</span><span class="identifier-syntax">text_output_struct</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">STREAM_OPEN_TO_FILE</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">parsed_filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">UTF8_ENC</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><a href="2-pe.html#SP2" class="function-link"><span class="function-syntax">PipelineErrors::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="string-syntax">"unable to open file named in pipeline step"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">active</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">to_stream</span><span class="plain-syntax"> = </span><span class="identifier-syntax">T</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1_2_2" class="named-paragraph-link"><span class="named-paragraph">Call the stage execution function</span><span class="named-paragraph-number">3.1.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">STREAM_CLOSE</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-pp.html#SP4" class="function-link"><span class="function-syntax">ParsingPipelines::will_read_a_file</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-pe.html#SP2" class="function-link"><span class="function-syntax">PipelineErrors::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="string-syntax">"no filename given in pipeline step"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">active</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"*memory"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">stage_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"read"</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><a href="2-pe.html#SP2" class="function-link"><span class="function-syntax">PipelineErrors::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="string-syntax">"'*memory' can be used only on reads"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">active</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">trees</span><span class="plain-syntax">[</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tree_argument</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">memory_repository</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="comment-syntax"> and do not call the executor function: that does the read</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1_2_1" class="named-paragraph-link"><span class="named-paragraph">Work out the filename</span><span class="named-paragraph-number">3.1.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1_2_2" class="named-paragraph-link"><span class="named-paragraph">Call the stage execution function</span><span class="named-paragraph-number">3.1.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-rp.html#SP3_1_2_2" class="named-paragraph-link"><span class="named-paragraph">Call the stage execution function</span><span class="named-paragraph-number">3.1.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-rp.html#SP3_1">&#167;3.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_1_2_1" class="paragraph-anchor"></a><b>&#167;3.1.2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Work out the filename</span><span class="named-paragraph-number">3.1.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">contains_slash</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">) == </span><span class="character-syntax">'/'</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">contains_slash</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">contains_slash</span><span class="plain-syntax">) </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">parsed_filename</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Filenames::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">parsed_filename</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Filenames::in</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_argument</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-rp.html#SP3_1_2">&#167;3.1.2</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP3_1_2_2" class="paragraph-anchor"></a><b>&#167;3.1.2.2. </b>The pipeline stops running (becomes inactive) as soon as one of the stage
functions returns <span class="extract"><span class="extract-syntax">FALSE</span></span>, or as soon as a pipeline processing error occurs,
whichever comes first.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Call the stage execution function</span><span class="named-paragraph-number">3.1.2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">active</span><span class="plain-syntax"> = (*(</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">step_stage</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">execute</span><span class="plain-syntax">))(</span><span class="identifier-syntax">step</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-rp.html#SP3_1_2">&#167;3.1.2</a> (five times).</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>In an ideal world, we would not track this in a global variable, but it is
not simple to remove the need for this (though, at the same time, it is needed
very little in practice, and never when this code runs in Inform 7).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="function-syntax">RunningPipelines::current_step</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">currently_running_pipeline_step</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. Popular symbols cache.</b>While working on a tree, the execution functions will frequently need
its most popular symbols &mdash; searching for these is not too slow, but even so,
once is enough. But we cache them on each step, wiping the cache at the end
of the step, since running a step changes the Inter tree and could conceivably
move, add or remove some of these symbols.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">object_kind_RPSYM</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">direction_kind_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_meta_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_noun_filter_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_scope_filter_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_reverse_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_slash_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_divider_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_result_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_special_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_number_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_noun_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_multi_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_multiinside_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_multiheld_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_held_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_creature_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_topic_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">verb_directive_multiexcept_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">code_ptype_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">plain_ptype_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">submodule_ptype_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">function_ptype_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">action_ptype_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">command_ptype_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">property_ptype_RPSYM</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">to_phrase_ptype_RPSYM</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MAX_RPSYM</span><span class="plain-syntax"> </span><span class="constant-syntax">100</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">RunningPipelines::get_symbol</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">RunningPipelines::get_symbol</span></span>:<br/><a href="2-rp.html#SP6">&#167;6</a><br/>Compile Splats Stage - <a href="3-css.html#SP4_2_3_1_1_1">&#167;4.2.3.1.1.1</a>, <a href="3-css.html#SP4_2_3_1_4_5_3_1_1">&#167;4.2.3.1.4.5.3.1.1</a>, <a href="3-css.html#SP4_3_3_1">&#167;4.3.3.1</a>, <a href="3-css.html#SP4_3_3_2">&#167;4.3.3.2</a>, <a href="3-css.html#SP7">&#167;7</a><br/>Kinds - <a href="5-knd.html#SP1_8">&#167;1.8</a>, <a href="5-knd.html#SP2">&#167;2</a><br/>Eliminate Redundant Matter Stage - <a href="6-erms.html#SP2">&#167;2</a>, <a href="6-erms.html#SP3_3">&#167;3.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">id</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">id</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">MAX_RPSYM</span><span class="plain-syntax">)) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"bad ID"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no step"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">tree</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols_fetched</span><span class="plain-syntax">[</span><span class="identifier-syntax">id</span><span class="plain-syntax">] == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols_fetched</span><span class="plain-syntax">[</span><span class="identifier-syntax">id</span><span class="plain-syntax">] = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">id</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">code_ptype_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">code_ptype_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LargeScale::package_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"_code"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">plain_ptype_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">plain_ptype_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LargeScale::package_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"_plain"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">submodule_ptype_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">submodule_ptype_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LargeScale::package_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"_submodule"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">function_ptype_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">function_ptype_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LargeScale::package_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"_function"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">action_ptype_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">action_ptype_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LargeScale::package_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"_action"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">command_ptype_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">command_ptype_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LargeScale::package_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"_command"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">property_ptype_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">property_ptype_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LargeScale::package_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"_property"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">to_phrase_ptype_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">to_phrase_ptype_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">LargeScale::package_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"_to_phrase"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">object_kind_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">object_kind_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"K_object"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">direction_kind_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">direction_kind_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"K3_direction"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_meta_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_meta_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_META"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_noun_filter_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_noun_filter_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_NOUN_FILTER"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_scope_filter_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_scope_filter_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_SCOPE_FILTER"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_reverse_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_reverse_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_REVERSE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_slash_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_slash_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_SLASH"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_divider_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_divider_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_DIVIDER"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_result_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_result_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_RESULT"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_special_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_special_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_SPECIAL"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_number_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_number_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_NUMBER"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_noun_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_noun_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_NOUN"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_multi_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_multi_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_MULTI"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_multiinside_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_multiinside_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_MULTIINSIDE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_multiheld_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_multiheld_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_MULTIHELD"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_held_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_held_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_HELD"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_creature_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_creature_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_CREATURE"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_topic_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_topic_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_TOPIC"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_directive_multiexcept_RPSYM:</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="constant-syntax">verb_directive_multiexcept_RPSYM</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LargeScale::find_symbol_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_MULTIEXCEPT"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="identifier-syntax">id</span><span class="plain-syntax">];</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>This variant is more interesting: it tries to find the symbol in the tree,
but if it can't, it makes one and creates a plug for it, expecting the true
definition (and thus a socket) to come later from some other material not yet
linked in.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">RunningPipelines::ensure_symbol</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">RunningPipelines::ensure_symbol</span></span>:<br/>Compile Splats Stage - <a href="3-css.html#SP4_2_3_1_4_5_3">&#167;4.2.3.1.4.5.3</a>, <a href="3-css.html#SP8_8">&#167;8.8</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">pipeline_step</span><span class="plain-syntax"> *</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">identifier</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">tree</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-rp.html#SP5" class="function-link"><span class="function-syntax">RunningPipelines::get_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">step</span><span class="plain-syntax">, </span><span class="identifier-syntax">id</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="identifier-syntax">id</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Wiring::plug</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">identifier</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">step</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ephemera</span><span class="plain-syntax">.</span><span class="element-syntax">cached_symbols</span><span class="plain-syntax">[</span><span class="identifier-syntax">id</span><span class="plain-syntax">];</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="2-pp.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-pm.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresssection"><a href="2-pp.html">pp</a></li><li class="progresscurrent">rp</li><li class="progresssection"><a href="2-pe.html">pe</a></li><li class="progresssection"><a href="2-ns.html">ns</a></li><li class="progresssection"><a href="2-rmss.html">rmss</a></li><li class="progresschapter"><a href="3-ps.html">3</a></li><li class="progresschapter"><a href="4-lbks.html">4</a></li><li class="progresschapter"><a href="5-msms.html">5</a></li><li class="progresschapter"><a href="6-erms.html">6</a></li><li class="progressnext"><a href="2-pe.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

